package com.lagou.edu.service.impl;

import com.lagou.edu.service.ServiceApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.apache.dubbo.config.annotation.Service;

@Service
public class IEmailInterfaceImpl implements ServiceApi {
    @Autowired
    private JavaMailSender javaMailSender;


    @Override
    public void sendEmail(String code) {
        sendMaill(code);
    }

    public Boolean sendMaill(String code) {
        SimpleMailMessage simpleMailMessage = new SimpleMailMessage();
        //邮件发送人
        simpleMailMessage.setFrom("javaspring123@126.com");
        //邮件接收人
        simpleMailMessage.setTo("211569430@qq.com");
        //邮件主题
        simpleMailMessage.setSubject("我的验证码8081");
        //邮件内容
        simpleMailMessage.setText("邮件内容");
        javaMailSender.send(simpleMailMessage);
        return true;
    }
}
